package top.yaofengqiao.springcloudsimple.redis.starter.service;

import org.redisson.api.RLock;

import java.time.Duration;

/**
 * @author yfq
 * @date 2024/6/7 10:24
 * @description
 */
public interface IRedisService {
    <T> void setValue(String key, T value);

    <T> void setValue(String key, T value, Duration duration);

    <T> T getValue(String key);

    boolean delete(String key);

    boolean exist(String key);

    <T> boolean setNx(String key, T value);

    <T> boolean setNx(String key, T value, Duration duration);

    long getIncrement(String key);

    void expires(String key, Duration duration);

    boolean tryLock(String key);

    void unLock(String key);

    RLock getLock(String key);
}
